home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / dos #33 < prev    next >
Text File  |  2022-08-26  |  3KB  |  143 lines

  1. ======================================
  2.       DOS & Don'ts -- Part 33
  3.  
  4.       by James Gregory Welier
  5. ======================================
  6.  
  7.       Part B:  The BAM block
  8.  
  9.  
  10.   The BAM (Block Availability Map)
  11.  
  12. block is track 18, block 0 of your
  13.  
  14. 1541 disk.  It has three main parts:
  15.  
  16. (See map 2: the BAM.)
  17.  
  18. 1. Directory link
  19. 2. BAM
  20. 3. Disk name and ID.
  21.  
  22. --------------------------------------
  23. Section 1: Directory link.
  24. --------------------------------------
  25.  
  26. The first two bytes of the BAM block
  27.  
  28. contain the numbers of the track and
  29.  
  30. block where the disk's directory
  31.  
  32. starts.  Whenever DOS wants to find
  33.  
  34. something on the disk, it starts by
  35.  
  36. looking here.  Normally, the directory
  37.  
  38. begins on track 18, block 1.
  39.  
  40. --------------------------------------
  41. Section 2: BAM
  42. --------------------------------------
  43.  
  44. The BAM keeps track of which parts of
  45.  
  46. the disk are used and which parts are
  47.  
  48. avialable for use by files.
  49.  
  50.   The block availability map takes up
  51.  
  52. the 4th through the 143rd bytes of
  53.  
  54. the BAM block -- a total of 140 bytes.
  55.  
  56. Each track on the disk is represented
  57.  
  58. by four bytes.  (140/4 = 35!  Exactly
  59.  
  60. the number of tracks on a disk!  What
  61.  
  62. a coincidence!)
  63.  
  64.   Thus, bytes 4 through 7 represent
  65.  
  66. track 1; bytes 8 through 11 represent
  67.  
  68. track 2; and so on up to track 35,
  69.  
  70. which is represented by bytes 140
  71.  
  72. through 143.
  73.  
  74. --------------------------------------
  75. Section 3: disk name and id.
  76. --------------------------------------
  77.  
  78. Bytes 144 through 161 of the BAM block
  79.  
  80. contain the disk name, filled out with
  81.  
  82. shifted space characters (CHR$(160)).
  83.  
  84. This is the name you gave your disk
  85.  
  86. when you NEWed it.
  87.  
  88.   Bytes 162 and 163 are the disk ID.
  89.  
  90. The two characters you see after the
  91.  
  92. disk name when you look at a directory
  93.  
  94. are the ID.  You assign an ID when you
  95.  
  96. NEW a disk.
  97.  
  98. ======================================
  99. ======================================
  100.  
  101. Map 2: the BAM:  track 18, sector 0
  102.  
  103. byte
  104. --------------------------------------
  105.  00  Track of first directory block.
  106.      Its value is normally eighteen.
  107.  01  Sector of first directory block.
  108.      Its value is normally one.
  109.  02 'A'
  110.  03  Zero
  111.  
  112. -------------------------------------
  113.  04-143  BAM.  Each group of four
  114.          bytes in this range is used
  115.          to represent the available
  116.          space on an entire track.
  117.          Each 4 bytes is a track
  118.          bit map.  See map 2a.
  119.  
  120. byte         byte         byte
  121.   4=track  1:  8=track  2: 12=track  3
  122.  16=track  4: 20=track  5: 24=track  6
  123.  28=track  7: 32=track  8: 36=track  9
  124.             .            .
  125.             .            .
  126.             .            .
  127. 124=track 31:128=track 32:132=track 33
  128. 136=track 34:140=track 35:
  129.  
  130.  
  131. bytes
  132. --------------------------------------
  133. 144-161 Disk name followed by shifted
  134.         spaces.
  135. 162-164 Disk id followed by a shifted
  136.         space
  137. 165-166 "2a"
  138. 167-170 Shifted spaces
  139. 171-255 Unused - all zeros.
  140. --------------------------------------
  141.  
  142. =======< continued in Part 34 >=======
  143.